package com.swf.common.data;

/**
 * description:数据基础类型
 * 
 * @version 1.0 2013-5-14
 * @author shenwf
 */
public class FwsDataElement {
	private String name;
	private String destName;
	private boolean append = false;

	public FwsDataElement() {
	}

	public FwsDataElement(String name) {
		this.name = name;
	}

	public Object clone() {
		FwsDataElement element = new FwsDataElement(this.name);
		element.setAppend(this.append);
		return element;
	}

	public void setId(String id) {
		this.name = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDestName() {
		return destName;
	}

	public void setDestName(String destName) {
		this.destName = destName;
	}

	public boolean isAppend() {
		return append;
	}

	public void setAppend(boolean append) {
		this.append = append;
	}

	@Override
	public String toString() {
		return toString(0);
	}

	public String toString(int tabCount) {
		StringBuffer buf = new StringBuffer();
		for (int i = 0; i < tabCount; i++)
			buf.append("\t");
		buf.append("<DataElement id=\"");
		buf.append(this.name);
		if ((this instanceof FwsIndexedCollection)
				|| (this instanceof FwsKeyedCollection)) {
			buf.append("\" append=\"" + this.append + "\"/>");
		} else {
			buf.append("\"/>");
		}
		return buf.toString();
	}
}
